//
//  OrderNewsCollectionViewCell.m
//  UniversalApp
//
//  Created by 志刚杨 on 2018/2/9.
//  Copyright © 2018年 voidcat. All rights reserved.
//

#import "OrderNewsCollectionViewCell.h"

@implementation OrderNewsCollectionViewCell


- (void)awakeFromNib {
    [super awakeFromNib];
    self.labNickname.shadowColor = [UIColor blackColor];    //设置文本的阴影色彩和透明度。
    self.labNickname.shadowOffset = CGSizeMake(1.0f, 1.0f);     //设置阴影的倾斜角度。
    self.status.backgroundColor = [UIColor colorWithHexString:@"E8488A"];
    self.charging.backgroundColor = [UIColor colorWithHexString:@"E8488A"];
    self.headImage.layer.cornerRadius = 10;
    self.headImage.layer.masksToBounds = YES;
    self.goodNum.hidden = YES;
}

- (void)setModel:(OrderModel *)personModel
{
    if(KIOSBASE)
    {
        self.headImage.image = [[CYCommon sharedCYCommon] getKatongImageWidthID:personModel.id];
    }
    else
    {
        [self.headImage sd_setImageWithURL:[[CYURLUtils sharedCYURLUtils] safeUrl:personModel.avatar] placeholderImage:[[CYCommon sharedCYCommon] getEpmayImage]];
    }
    self.headImage.contentMode = UIViewContentModeScaleAspectFill;
    self.labNickname.text = personModel.user_nickname;
//    [self.goodNum setTitle:personModel.evaluation forState:UIControlStateNormal];
//    [self.goodNum setImage:IMAGE_NAMED(@"common_goodReputation") forState:UIControlStateNormal];
//    self.goodNum.spacingBetweenImageAndTitle = 2;
    
    //设置等级
    [self.level setTitle:personModel.level forState:UIControlStateNormal];
    [self.level setImage:IMAGE_NAMED(@"mine_level_05") forState:UIControlStateNormal];
    self.level.backgroundColor = MainColor;
    self.level.contentEdgeInsets = UIEdgeInsetsMake(2, 3, 2, 3);
    self.level.imageView.clipsToBounds = YES;
    
    self.level.imageView.contentMode = UIViewContentModeScaleAspectFill;
    //    self.goodNum.imageView.size = CGSizeMake(1, 1);
    self.level.spacingBetweenImageAndTitle = 0;
    
    //设置状态
    
    UIImage *radImage = [[UIImage imageWithColor:MainColor size:CGSizeMake(3, 3)] imageByRoundCornerRadius:1.5];
    
    if (personModel.is_live || personModel.is_lives) {
        [self.status setTitle:ASLocalizedString(@"直播中")forState:UIControlStateNormal];
        radImage = [[UIImage imageWithColor:[UIColor colorWithHexString:@"FF0000"] size:CGSizeMake(3, 3)] imageByRoundCornerRadius:1.5];
    } else if([personModel.is_online isEqualToString:@"1"]) {
        [self.status setTitle:ASLocalizedString(@"在线")forState:UIControlStateNormal];
        radImage = [[UIImage imageWithColor:[UIColor colorWithHexString:@"3CE280"] size:CGSizeMake(3, 3)] imageByRoundCornerRadius:1.5];
    } else {
        [self.status setTitle:ASLocalizedString(@"离线")forState:UIControlStateNormal];
        radImage = [[UIImage imageWithColor:[UIColor colorWithHexString:@"C6C6C6"] size:CGSizeMake(3, 3)] imageByRoundCornerRadius:1.5];
    }
    
    
    [self.status setImage:radImage forState:UIControlStateNormal];
    self.status.spacingBetweenImageAndTitle = 2;
    
    if (IsCurrentUserMale) {
        [self.charging setTitle:[NSString stringWithFormat:@"¥%@", personModel.charging_coin] forState:UIControlStateNormal];
        self.charging.spacingBetweenImageAndTitle = 2;
    } else {
        self.charging.hidden = YES;
    }

}

//- (void)awakeFromNib {
//    [super awakeFromNib];
//    ViewRadius(self.headerImage, 35/2);
//    self.labLocalhost.textColor = MainColor;
//    self.headerImage.contentMode = UIViewContentModeScaleAspectFill;
//}
//
//
//-(void)setModel:(OrderModel *)model
//{
//    _model = model;
//
//    if(KIOSBASE)
//    {
//        self.headerImage.image = [[CYCommon sharedCYCommon] getKatongImageWidthID:model.id];
//    }
//    else{
//
//        [self.headerImage sd_setImageWithURL:[[CYURLUtils sharedCYURLUtils] safeUrl:model.avatar] placeholderImage:[[CYCommon sharedCYCommon] getEpmayImage]];
//    }
//
//    if([model.islogin isEqualToString:@"1"]){
//        UIImage *radImage = [[UIImage imageWithColor:MainColor size:CGSizeMake(3, 3)] imageByRoundCornerRadius:1.5];
//        self.dotImage.image = radImage;
//    }
//    else
//    {
//        UIImage *radImage = [[UIImage imageWithColor:CLightGray size:CGSizeMake(3, 3)] imageByRoundCornerRadius:1.5];
//        self.dotImage.image = radImage;
//    }
//
//    self.labnickname.text = model.user_nickname;
//
//    [self.level getViewType:model.sex AndLevel:model.level];
//    self.labLocalhost.text = model.address;
//}

@end
